package com.ruoyi.web.controller.system;

import com.ruoyi.appointment.domain.Appointment;
import com.ruoyi.appointment.service.IAppointmentService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import org.apache.ibatis.annotations.Result;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * Date:2024/7/8
 * Author：顾雁影
 * Description:
 */
@RestController
@RequestMapping("/app/Appointment")
public class AppAppointmentController {
    @Resource
    private IAppointmentService iAppointmentService;

    @GetMapping("/InfoList/{user_Id}")
    public AjaxResult getUserAppointment(@PathVariable("user_Id")long user_Id){
        List<Appointment> appointments = iAppointmentService.selectAppointmentListByUserId(user_Id);
        return AjaxResult.success(appointments);
    }
    /**
     * 新增预约服务
     */
    @PostMapping("/addAppointment")
    public AjaxResult add(@RequestBody Appointment appointment)
    {
        return AjaxResult.success(iAppointmentService.insertAppointment(appointment));
    }
}
